package com.vilinno.tlias.controller;

import com.vilinno.tlias.pojo.ClazzCountOption;
import com.vilinno.tlias.pojo.JobOption;
import com.vilinno.tlias.pojo.Result;
import com.vilinno.tlias.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("/report")
@RestController
public class ReportController {

    private static final Logger log = LoggerFactory.getLogger(ReportController.class);

    @Autowired
    private ReportService reportService;

    /**
     * 统计不同职位员工人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){

        log.info("统计员工职位人数");
        JobOption jobOption=reportService.getEmpJobData();
        return Result.success(jobOption);

    }

    /**
     * 统计员工性别信息
     * @return
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){

        log.info("统计员工性别信息");
        List<Map<String,Object>> genderList= reportService.getEmpGenderData();
        return Result.success(genderList);

    }

    /**
     * 统计班级学生人数
     * @return
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("统计班级学生人数");
        ClazzCountOption clazzCountOption =reportService.getStudentCountData();
        return  Result.success(clazzCountOption);
    }

    /**
     * 统计学生学历信息
     * @return
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计学生学历信息");
        List<Map<String,Object>> degreeList =reportService.getStudentDegreeData();
        return  Result.success(degreeList);
    }

}
